import { Layout, Menu, Dropdown, Badge, Avatar, Select } from 'antd';
import { useEffect, useState } from "react";
import {getLocale,NavLink,setLocale,useIntl}from "umi";
import "./students.less"
import { BellOutlined } from '@ant-design/icons';
// 引入面包屑组件
import Breadcrumb from '../components/breadcrumb';
import { gitUserInfo } from '@/services/modules/useref';

const { Header, Footer, Content } = Layout
//实训
const practical = (
    <Menu>
        <Menu.Item key="1">
            <NavLink to="/student/planList/planList"> 计划</NavLink>
        </Menu.Item>
        <Menu.Item key="2">
            <NavLink to="/student/training/training">进度</NavLink>
        </Menu.Item>
        <Menu.Item key="3">
            <NavLink to="/student/defence/defence">答辩</NavLink>
        </Menu.Item>

    </Menu>
);
// 面试
const plan = (
    <Menu>
        <Menu.Item key="1">
            <NavLink to="/student/interView/interviewList"> 面试记录</NavLink>
        </Menu.Item>
        <Menu.Item key="2">
            <NavLink to="/student/interView/interviewManage"> 面试记录管理</NavLink>
        </Menu.Item>
        <Menu.Item key="3">
            <NavLink to="/student/interView/rankList"> 面试排行榜</NavLink>
        </Menu.Item>
    </Menu>
);
// 问答
const questions = (
    <Menu>
        <Menu.Item key="1">
            <NavLink to="/student/question/questionDetail">
                问答列表
            </NavLink>
        </Menu.Item>
        <Menu.Item key="2">
            <NavLink to="/student/manage/manage">
                问答管理
            </NavLink>
        </Menu.Item>
    </Menu>
);

// 个人中心
const personage = (
    <Menu>
        <Menu.Item>
            <NavLink to="/student/userInfo/teacherPersonCenter">
                个人中心
            </NavLink>
        </Menu.Item>
        <Menu.Item>
            <NavLink to="/student/userInfo/needHandle">
                我的待办
            </NavLink>
        </Menu.Item>
        <Menu.Item>
            <NavLink to="/login/login">
                退出
            </NavLink>
        </Menu.Item>
    </Menu>
);

// 默认语言
const enLanguage: { [key: string]: string } = {
    "en": "en-US",
    "en-US": "en-US",
}

const Student: React.FC = (props) => {
    let [img, setImg] = useState()

    // 定义默认的值
    const intl = useIntl();
    useEffect(() => {
        console.log(navigator.language)
        let language = navigator.language;
        if (language) {
            setLocale(enLanguage[language], false);
        }
    }, [])

    useEffect(() => {
        gitUserInfo().then(ok => {
            if(ok.code===200){
              setImg(ok.user.avatar)
            }
        })
    }, [])


    return <Layout >
        <Header style={{background:"#fff"}}>
            <div className='headerStudents'>
                <img src="http://111.203.59.61:8060/static/img/bw.a718dea8.png" alt="" />
                <div className="nav">
                    <NavLink to='/student/studentSkill/studentSkill'>{intl.formatMessage({ id: "breadcrumb.postSkill" })}</NavLink>
                    <NavLink to='/student/proManagement/proManagement'>{intl.formatMessage({ id: "breadcrumb.teachers" })}</NavLink>
                    <NavLink to='/student/myProject/myProject'>{intl.formatMessage({ id: "breadcrumb.proManagement" })}</NavLink>
                    <Dropdown overlay={plan}>
                        <span>{intl.formatMessage({ id: "breadcrumb.interview" })}</span>
                    </Dropdown>
                    <Dropdown overlay={questions}>
                        <span>{intl.formatMessage({ id: "breadcrumb.essay" })}</span>
                    </Dropdown>
                </div>
                <Dropdown overlay={personage} className='personage'>
                    <span><img src={`http://111.203.59.61:8060${img}`} alt="" style={{ width: "35px", height: "35px", borderRadius: "50%", marginRight: "10px" }} />黄辉</span>
                </Dropdown>
                <Select value={getLocale()} onChange={value => setLocale(value, false)}>
                    <Select.Option style={{ width: "100px", height: "30px" }} value="en-US">Engilish</Select.Option>
                    <Select.Option style={{ width: "100px", height: "30px" }} value="zh-CN">中文</Select.Option>
                    <Select.Option style={{ width: "100px", height: "30px" }} value="ko-KR">한국어</Select.Option>
                </Select>
            </div>
        </Header>
        {/*学生端哦  */}
        <Content style={{flex:"1"}}>{props.children}</Content>
        <Footer>
            <div data-v-01b3f466="" data-v-7178e8ae="" className="bw_bottom">
                <div data-v-01b3f466="" className="b_b_detail">
                    <div data-v-01b3f466="" className="b_b_left">
                        <div data-v-01b3f466="" className="bw_img">
                            <img src="http://111.203.59.61:8060/static/img/bottom_logo.c8aa9859.png" alt="" />
                        </div>
                        <div data-v-01b3f466="" className="b_w_tel">400-008-0987</div></div>
                    <div data-v-01b3f466="" className="b_b_middle"><div data-v-01b3f466="" className="middle_one middle">
                        <div data-v-01b3f466="" className="middle_title">走进八维</div>
                        <div data-v-01b3f466="" className="href_a">
                            <a data-v-01b3f466="" href="http://bwie.cn/bwie/about.html">集团概况</a></div>
                        <div data-v-01b3f466="" className="href_a">
                            <a data-v-01b3f466="" href="http://bwie.cn/bwie/news/index.html">八维动态</a></div>
                        <div data-v-01b3f466="" className="href_a"><a data-v-01b3f466="" href="http://bwie.cn/bwie/lead.html">领导关怀</a></div>
                        <div data-v-01b3f466="" className="href_a"><a data-v-01b3f466="" href="http://bwie.cn/bwie/honour.html">企业荣誉</a></div></div>
                        <div data-v-01b3f466="" className="middle_two middle">
                            <div data-v-01b3f466="" className="middle_title">八维文化</div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/culture.html">八维理念</a></div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/spirit.html">八维精神</a></div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/dak.html">文化驿站</a></div></div>
                        <div data-v-01b3f466="" className="middle_three middle">
                            <div data-v-01b3f466="" className="middle_title">社会责任</div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/duty/public.html">社会公益</a></div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/duty/great.html">大善之举</a></div></div>
                        <div data-v-01b3f466="" className="middle_four middle">
                            <div data-v-01b3f466="" className="middle_title">联系我们</div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/partners.html">业务合作</a></div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/sign_up.html">咨询报名</a></div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/concact.html">联系方式</a></div>
                        </div>
                    </div>
                    <div data-v-01b3f466="" className="b_b_right">
                        <img src="http://111.203.59.61:8060/static/img/wechat.e60a83ec.png" alt="" />
                        <div data-v-01b3f466="" className="wechat_text">八维微信公众号</div></div></div>
                <div data-v-01b3f466="" className="b_b_sign">京公网安备 11010802031438号 © Copyright 2020. 八维教育版权所有 | 京ICP备12008262号-12</div>
            </div>
        </Footer>
    </Layout >
}

export default Student